var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
    })(e, t);
}, function(e, t) {
    function n() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, 
    new n());
}), a = this && this.__decorate || function(e, t, o, n) {
    var s, i = arguments.length, r = i < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, o) : n;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(e, t, o, n); else for (var a = e.length - 1; 0 <= a; a--) (s = e[a]) && (r = (i < 3 ? s(r) : 3 < i ? s(t, o, r) : s(t, o)) || r);
    return 3 < i && r && Object.defineProperty(t, o, r), r;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("Global"), s = e("AudioManager"), c = e("PersonView"), l = e("GameData"), d = e("EggsManager"), u = e("DataManager"), p = e("LoadManager"), h = e("UIManager"), f = e("WebManager"), g = cc._decorator, m = g.ccclass, y = g.property, v = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.personView = null, e.shadow = null, e.time = 5, e.count = 0, e.total = 7, 
        e.idx = 5, e;
    }
    return i(e, t), e.prototype.onLoad = function() {
        cc.systemEvent.on("refresh_person_skin", this.doRefresh, this);
    }, e.prototype.onDestroy = function() {
        cc.systemEvent.off("refresh_person_skin", this.doRefresh, this);
    }, e.prototype.onClick = function() {
        var t, o = this;
        -1 == d.default.getInstance().checkEggPerson(this.idx) && (0 == this.count && this.scheduleOnce(this.doTimer, this.time), 
        this.count < this.total ? (f.default.getInstance().sentLog("触发皮肤彩蛋id:" + this.idx), 
        s.default.getInstance().playAudio("彩蛋触发鸣笛", .6), this.count++) : (f.default.getInstance().sentLog("获得皮肤彩蛋id:" + this.idx), 
        s.default.getInstance().playAudio("皮肤出现"), this.shadow.parent = cc.Canvas.instance.node, 
        this.shadow.active = !0, t = new cc.Node().addComponent(sp.Skeleton), p.default.getInstance().loadRes({
            url: "skeleton/皮肤" + r.G.eggPersonModelList[this.idx].m + "/xiaoli",
            type: sp.SkeletonData
        }).then(function(e) {
            t.skeletonData = e, t.node.setPosition(cc.v2(20, -70)), t.node.parent = cc.Canvas.instance.node, 
            t.node.scale = 1, t.node.zIndex = 1, cc.tween(t.node).by(.5, {
                position: cc.v3(-50, 0)
            }).by(1.7, {
                position: cc.v3(75, 0)
            }).by(.8, {
                position: cc.v3(-25, 0)
            }).start(), t.setAnimation(0, "animation", !1), s.default.getInstance().playAudio("彩蛋皮肤" + r.G.eggPersonModelList[o.idx].m, 1), 
            t.setCompleteListener(function() {
                o.shadow.parent = o.node, o.shadow.active = !1, t.setCompleteListener(null), t.node.destroy(), 
                h.default.getInstance().loadPopPnl("egg_reward", {
                    type: r.RewardType.SKIN,
                    idx: o.idx
                });
            });
        }), d.default.getInstance().updateEggPerson(this.idx), l.GD.personIdx = -1 - this.idx, 
        l.GD.eggsHintState = 1, u.default.getInstance().save(), cc.systemEvent.off("refresh_person_skin", this.doRefresh, this)));
    }, e.prototype.start = function() {
        this.doRefresh();
    }, e.prototype.doRefresh = function() {
        0 == this.personView.personIdx ? this.node.active = !0 : this.node.active = !1;
    }, e.prototype.doTimer = function() {
        this.count = 0;
    }, e.prototype.stopTimer = function() {
        this.unschedule(this.doTimer);
    }, a([ y(c.default) ], e.prototype, "personView", void 0), a([ y(cc.Node) ], e.prototype, "shadow", void 0), 
    a([ m ], e);
}(cc.Component);

n.default = v;